package Test;
//输入描述:
//一个字符串,仅由小写字母组成。(字符串长度不大于300000)
//输出描述:
//一个字符串,为"点击消除”后的最终形态。若最终的字符串为空串,则输出0.
//输入:abbc
//输出:ac
import java.util.Scanner;
public class dowm {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char [] s = in.next().toCharArray();
        StringBuilder st = new StringBuilder();
        for(int i = 0;i< s.length;i++){
            char ch = s[i];
            if(st.length() != 0 && ch == st.charAt(st.length() -1)){
                //出栈
                st.deleteCharAt(st.length()-1);
            }else{
                //进栈
                st.append(ch);
            }
        }
        System.out.println(st.length() == 0 ? 0 :st.toString());

    }
}
